//
//  InputTextViewController.m
//  SenMo
//
//  Created by zengyuan on 16/2/4.
//  Copyright © 2016年 ZengYuan. All rights reserved.
//

#import "InputTextViewController.h"

@interface InputTextViewController ()

@end

@implementation InputTextViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 10, self.view.frame.size.width
                                            , 50)];
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    
    textField = [[UITextField alloc]initWithFrame:CGRectInset(view.bounds, 10, 5)];
    [view addSubview:textField];
    textField.borderStyle = UITextBorderStyleNone;
    textField.text = self.originalText?self.originalText:@"";
    self.titleLabel.text = self.navTitle;
    
    [self.rightBtnPar setTitle:@"保存" forState:UIControlStateNormal];
}


-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)navRightAction{
    
    if ([textField.text length]==0) {
        MBALERT(@"内容不能为空");
        return;
    }
    
    if (self.delegate) {
        [self.delegate DidInputNewText:textField.text];
        [self.navigationController popViewControllerAnimated:YES];
    }
    
}




/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
